﻿// Copyright (c) 2006 Antu Corporation。 
// 创建人  ：LinJian
// 创建时间：2007-3-23 16:19:27
using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace Antu.Business.Config
{
    /// <!--
    /// 功能描述  : FTP连接信息节点
    /// 创建人  : LinJian
    /// 创建时间: 2007-3-23 16:19:39
    /// 修改人  : 暂无他人修改
    /// 修改时间: 2007-3-23 16:19:41
    /// -->
    public class ChildSectionForFtp : ConfigurationElement
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public ChildSectionForFtp()
        {
        }

        /// <summary>
        /// 构造函数(设置属性值)
        /// </summary>
        /// <param name="strAttributeVal">属性值</param>
        public ChildSectionForFtp(string strAttributeVal)
        {
            SectionDescription = strAttributeVal;
        }

        /// <summary>
        /// 自定义字节属性值(节点描述)
        /// </summary>
        [ConfigurationProperty("SectionDescription", DefaultValue = "FTP连接信息", IsRequired = false)]
        [StringValidator(InvalidCharacters = "()[]{}/\"\\", MinLength = 1, MaxLength = 100)]
        public String SectionDescription
        {
            get
            {
                return (String)this["SectionDescription"];
            }
            set
            {
                this["SectionDescription"] = value;
            }
        }

        /// <summary>
        /// 自定义字节名(Ftp连接信息)
        /// </summary>
        [ConfigurationProperty("FtpInfo")]
        public ChildSectionForFtpInfo FtpInfo
        {
            get
            {
                return (ChildSectionForFtpInfo)this["FtpInfo"];
            }
            set
            {
                this["FtpInfo"] = value;
            }
        }
    }

    #region FTP的连接信息
    /// <!--
    /// 功能描述  : LDC中心数据库的连接信息
    /// 创建人  : LinJian
    /// 创建时间: 2007-3-23 15:00:48
    /// 修改人  : 暂无他人修改
    /// 修改时间: 2007-3-23 15:00:50
    /// -->
    public class ChildSectionForFtpInfo : ConfigurationElement
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public ChildSectionForFtpInfo()
        {
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="strFileType">FTP上传的文件类型</param>
        /// <param name="strDemainName">域名</param>
        /// <param name="strServer">服务器名</param>
        /// <param name="nPort">端口</param>
        /// <param name="strUser">用户名</param>
        /// <param name="strPassword">密码</param>
        public ChildSectionForFtpInfo(string strFileType, string strDemainName, string strServer,int nPort, string strUser, string strPassword)
        {
            FileType = strFileType;
            DomainName = strDemainName;
            Server = strServer;
            Port = nPort;
            User = strUser;
            Password = strPassword;
        }

        #region 自定义属性
        /// <summary>
        /// 自定义字节属性(上传的文件类型)
        /// </summary>
        [ConfigurationProperty("FileType", DefaultValue = "txt|doc|jpg", IsRequired = true)]
        [StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/.;'\"\\", MinLength = 1, MaxLength = 50)]
        public String FileType
        {
            get
            {
                return (String)this["FileType"];
            }
            set
            {
                this["FileType"] = value;
            }
        }

        /// <summary>
        /// 自定义字节属性(域名)
        /// </summary>
        [ConfigurationProperty("DomainName", DefaultValue = "AntuFtpServer", IsRequired = true)]
        [StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/;'\"|\\", MinLength = 1, MaxLength = 30)]
        public String DomainName
        {
            get
            {
                return (String)this["DomainName"];
            }
            set
            {
                this["DomainName"] = value;
            }
        }

        /// <summary>
        /// 自定义字节属性(服务器名)
        /// </summary>
        [ConfigurationProperty("Server", DefaultValue = "192.168.3.100", IsRequired = true)]
        [StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/;'\"|\\", MinLength = 1, MaxLength = 30)]
        public String Server
        {
            get
            {
                return (String)this["Server"];
            }
            set
            {
                this["Server"] = value;
            }
        }

        /// <summary>
        /// 自定义字节属性(端口号)
        /// </summary>
        [ConfigurationProperty("Port", DefaultValue = "21", IsRequired = true)]
        public int Port
        {
            get
            {
                return (int)this["Port"];
            }
            set
            {
                this["Port"] = value;
            }
        }

        /// <summary>
        /// 自定义字节属性(用户)
        /// </summary>
        [ConfigurationProperty("User", DefaultValue = "test", IsRequired = true)]
        [StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/;'\"|\\", MinLength = 1, MaxLength = 30)]
        public String User
        {
            get
            {
                return (String)this["User"];
            }
            set
            {
                this["User"] = value;
            }
        }

        /// <summary>
        /// 自定义字节属性(密码)
        /// </summary>
        [ConfigurationProperty("Password", DefaultValue = "1", IsRequired = true)]
        [StringValidator(InvalidCharacters = "~!@#$%^&*()[]{}/;'\"|\\", MinLength = 1, MaxLength = 30)]
        public String Password
        {
            get
            {
                return (String)this["Password"];
            }
            set
            {
                this["Password"] = value;
            }
        } 
        #endregion
    }
    #endregion
}
